package com.example.p6_big;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class HomeActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tv_title;
    private EditText et_money;
    private TextView tv_go;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        initView();
    }

    private void initView() {
        tv_title = (TextView) findViewById(R.id.tv_title);
        et_money = (EditText) findViewById(R.id.et_money);
        tv_go = (TextView) findViewById(R.id.tv_go);

        tv_go.setOnClickListener(this);
    }

    private void submit() {
        // validate
        String money = et_money.getText().toString().trim();
        if (TextUtils.isEmpty(money)) {
            Toast.makeText(this, "money不能为空", Toast.LENGTH_SHORT).show();
            return;
        }

        Intent intent = new Intent(this, ChangeActivity.class);
        intent.putExtra("m", money);
        startActivity(intent);


    }

    @Override
    public void onClick(View v) {
        submit();
    }
}